class Hello:
    hair = 'black'

    def __init__(self, name='hello', age=8):
        self.name = name
        self.age = age

    def say(self, content):
        print(content)


h = Hello()
print(h.hair)
print(h.name)
h.say("this is my first helloclass")

h.name = 'tom'
print(h.name, h.age)

h.skills = ['say', 'eat', 'thinking']
print(h.skills)


# del h.name
# print(h.name)

def info(self):
    print("----info----", self)


h.foo = info

h.foo(h)

h.bar = lambda self: print("----info----", self)
h.bar(h)


class Dog:
    def jump(self):
        print("execute jump method:")

    def run(self):
        self.jump()
        print("execute run method:")


d = Dog()
d.run()


class ReturnSelf:
    def grow(self):
        if hasattr(self, 'age'):
            self.age += 1
        else:
            self.age = 1
        return self


rs = ReturnSelf()
rs.grow()
print(rs.age)
rs.grow().grow().grow()
print(rs.age)


class Bird:
    @classmethod
    def fly(cls):
        print("helloclass method:", cls)

    @staticmethod
    def info(p):
        print("static method:", p)


Bird.fly()
Bird.info("hello")

b = Bird()
b.fly()
b.info("hello")
